package com.zpself.module.多线程.Lock;

import org.junit.Test;

import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;

/**
 * @author By ZengPeng
 * @Description
 * @date in  2021/3/4 10:20
 * @Modified By
 */
public class ReentrantReadWriteLock分析 {

    private ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
    @Test
    public void  code(){
        //写锁
        lock.writeLock().lock();
        // 00000000 00000000 00000000 00000001   -1
        //MAX_COUNT = 65535  左移16位 减一
        // 00000000 00000000 11111111 11111111

        //EXCLUSIVE_MASK  = 65535    且与c & EXCLUSIVE_MASK;得到c 低16位的值
        // 00000000 00000000 11111111 11111111





        //读锁
        lock.readLock().lock();
    }

}
